import 'package:flutter/material.dart';

class DefineAlertDialog extends AlertDialog {

  final Widget? child;
  const DefineAlertDialog({Key? key,required this.child}):super(key: key);

  @override
  Widget build(BuildContext context) {
       return AlertDialog(
                //显示方向
                //alignment: Alignment.centerLeft,
                //距离屏幕边距
                //insetPadding: const EdgeInsets.symmetric(vertical: 0,horizontal: 10),
                //内容边距
                contentPadding: const EdgeInsets.symmetric(vertical: 0,horizontal: 0),
                //背景色
                backgroundColor: Colors.transparent,
                //内容
                content: Container(
                  decoration: BoxDecoration(color: Colors.grey,borderRadius: BorderRadius.circular(20)),
                  width: 200,
                  height: 200,
                  child: child,
                ),
             );

       //源码案例
       //   AlertDialog(
       //       title: const Text('AlertDialog Title'),
       //       content: SingleChildScrollView(
       //         child: ListBody(
       //           children: const <Widget>[
       //             Text('This is a demo alert dialog.'),
       //             Text('Would you like to approve of this message?'),
       //           ],
       //         ),
       //       ),
       //       actions: <Widget>[
       //         TextButton(
       //           child: const Text('Approve'),
       //           onPressed: () {
       //             Navigator.of(context).pop();
       //           },
       //         ),
       //       ],
       // );
  }
}